<?php

/**
 * This is the model class for table "sq_sysuser".
 *
 * The followings are the available columns in table 'sq_sysuser':
 * @property integer $Id
 * @property string $UserName
 * @property string $UserPass
 * @property string $UserEmail
 * @property string $UserTel
 * @property integer $LoginState
 * @property integer $LastLoginTime
 * @property integer $Created
 * @property integer $Updated
 */
class Sysuser extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return Sysuser the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'sq_sysuser';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('LoginState, LastLoginTime, Created, Updated', 'numerical', 'integerOnly'=>true),
			array('UserName, UserPass, UserEmail', 'length', 'max'=>100),
			array('UserTel', 'length', 'max'=>20),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('Id, UserName, UserPass, UserEmail, UserTel, LoginState, LastLoginTime, Created, Updated', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'Id' => 'ID',
			'UserName' => 'User Name',
			'UserPass' => 'User Pass',
			'UserEmail' => 'User Email',
			'UserTel' => 'User Tel',
			'LoginState' => 'Login State',
			'LastLoginTime' => 'Last Login Time',
			'Created' => 'Created',
			'Updated' => 'Updated',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('Id',$this->Id);
		$criteria->compare('UserName',$this->UserName,true);
		$criteria->compare('UserPass',$this->UserPass,true);
		$criteria->compare('UserEmail',$this->UserEmail,true);
		$criteria->compare('UserTel',$this->UserTel,true);
		$criteria->compare('LoginState',$this->LoginState);
		$criteria->compare('LastLoginTime',$this->LastLoginTime);
		$criteria->compare('Created',$this->Created);
		$criteria->compare('Updated',$this->Updated);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}